package com.turnengine.client.common.command.gwt;

import static com.javabi.common.dependency.DependencyFactory.getDependency;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.javabi.codebuilder.generated.gwt.IGeneratedRemoteServiceServlet;
import com.javabi.command.ICommandRequestList;
import com.javabi.command.ICommandResponseList;
import com.javabi.command.executor.ICommandExecutorService;

public class ExecuteCommandServlet extends RemoteServiceServlet implements IGeneratedRemoteServiceServlet, ExecuteCommandService {

	private static final long serialVersionUID = -6660166422086424751L;

	@Override
	public ICommandResponseList executeCommand(ICommandRequestList requestList) {
		ICommandExecutorService service = getDependency(ICommandExecutorService.class);
		ICommandResponseList responseList = service.execute(requestList);
		responseList.setRequestList(null);
		return responseList;
	}
}
